package com.approval.approvalapp.util;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Window;
import android.view.WindowManager;

import com.approval.approvalapp.R;
import com.bumptech.glide.Glide;

import butterknife.Bind;
import butterknife.ButterKnife;
import uk.co.senab.photoview.PhotoView;

public class PicPreviewActivity extends AppCompatActivity {

    @Bind(R.id.iv)
    PhotoView iv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);

        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);

        setContentView(R.layout.activity_photo_preview);
        ButterKnife.bind(this);

        Glide.with(this).load(getIntent().getStringExtra("path")).into(iv);
    }

    public static void goInto(Context context, String photopath) {
        Intent intent = new Intent();
        intent.setClass(context, PicPreviewActivity.class);
        intent.putExtra("path", photopath);
        context.startActivity(intent);
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        ButterKnife.unbind(this);
    }
}
